export const useDirectStore = defineStore('direct', () => {
  const customerObj = ref(); // 点击详情传递的对象
  const contactObj = ref(); // 点击详情传递的对象

  const directDetailObj = ref(); // 点击详情传递的对象

  // 细单相关刷新标志
  const hadDoneOnDtl = ref(false); // 细单是否有操作

  // 总单在detail页面是否已刷新过
  const orderDetailRefreshed = ref(false); // 总单详情是否已在detail页面刷新过

  const setCustomerObj = (obj: any) => {
    customerObj.value = obj;
  };
  const setContactObj = (obj: any) => {
    contactObj.value = obj;
  };

  const setDirectDetailObj = (obj: any) => {
    directDetailObj.value = obj;
  };

  const setHadDoneOnDtl = (hadDone: boolean) => {
    hadDoneOnDtl.value = hadDone;
  };

  const setOrderDetailRefreshed = (refreshed: boolean) => {
    orderDetailRefreshed.value = refreshed;
  };

  return {
    customerObj,
    contactObj,
    directDetailObj,
    hadDoneOnDtl,
    orderDetailRefreshed,
    setCustomerObj,
    setContactObj,
    setDirectDetailObj,
    setHadDoneOnDtl,
    setOrderDetailRefreshed,
  };
});
